# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=wifi-pumpkin
_pkgname=wifipumpkin3
pkgver=v1.1.7.r2.g344a475
pkgrel=6
epoch=2
groups=('blackarch' 'blackarch-wireless' 'blackarch-dos' 'blackarch-spoof'
        'blackarch-exploitation' 'blackarch-sniffer' 'blackarch-social')
pkgdesc='Framework for Rogue Wi-Fi Access Point Attack.'
arch=('any')
url='https://github.com/P0cL4bs/wifipumpkin3'
license=('MIT')
depends=('python' 'python-netifaces' 'python-netaddr' 'python-dhcplib'
         'python-tabulate' 'python-beautifultable' 'python-urwid'
         'python-termcolor' 'python-twisted' 'python-pyqt5' 'python-pyqt5-sip'
         'python-pyopenssl' 'python-asn1crypto' 'python-beautifulsoup4'
         'python-bs4' 'python-dnslib' 'python-loguru' 'python-isc_dhcp_leases'
         'python-dnspython' 'python-flask' 'python-coverage' 'python-scapy'
         'python-scapy-http' 'python-lxml' 'dhcp' 'networkmanager' 'responder'
         'python-wcwidth' 'python-werkzeug' 'python-flask-restful'
         'python-pyjwt' 'python-ping3' 'python-aiofiles')
makedepends=('git' 'python-setuptools' 'python-pip' 'python-wheel')
source=("$pkgname::git+https://github.com/P0cL4bs/$_pkgname.git"
        'requirements.txt.patch')
sha512sums=('SKIP'
            'cee46ad0d3afd5843c7e6b35b4d822083682e766139763231ea6e2737e4ec10e6428a6b9b31b5e7fe83f51edb98d00f7256491f66d12502358028fff5aec14ad')

pkgver() {
  cd $pkgname

  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd $pkgname

  patch -p0 < "$srcdir/requirements.txt.patch"
}

build() {
  cd $pkgname

  python setup.py build
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/share/$pkgname"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  mv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/bin/$pkgname"
  mv "$pkgdir/usr/$_pkgname" "$pkgdir/usr/share/$pkgname/"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" *.md
  rm "$pkgdir/usr/share/doc/$pkgname/LICENSE.md"
  install -Dm 644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

